package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum TagType {
	GOODS(0,"商品"),
	SHOP(1,"店铺");
	
	private Integer value;
	private String text;
	
	private TagType(Integer value,String text){
		this.value = value;
		this.text = text;
	}
	
	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}
	
	public static TagType toFlag(int value){
		if(GOODS.value == value){
			return GOODS;
		}else if(SHOP.value == value){
			return SHOP;
		}else{
			throw new InvalidArgumentException("Unknown type[" + value + "].");
		}
	}
}
